# Maintainer: yumetodo <yume-wikijp@live.jp>

_realname=hexyl
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.9.0
pkgrel=1
pkgdesc="A command-line hex viewer"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://github.com/sharkdp/hexyl"
license=('APACHE' 'MIT')
depends=()
makedepends=("${MINGW_PACKAGE_PREFIX}-rust")
source=(
  "${url}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
)
sha512sums=('a6fc8315dd115ac4b3e3717ffc6e218bf587749149405250796a435834252382fe51c613688729d7de6911340bf6f2002ae945c0f19b499dacc767e995958ce6')
b2sums=('244c133a06e6432937803e84b2b64cd762a75c05490189533271522a069b68b639e7517904e5585d8b617b68885da1a092d6bdae2d6c15bd53d38bb89d96517f')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cargo build --release --locked
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cargo test --release --locked
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  install -Dm 755 "target/release/${_realname}" "${pkgdir}${MINGW_PREFIX}/bin/${_realname}"
  install -Dm 644 LICENSE* -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
}
